Old English swerian "take an oath" (class VI strong verb; past tense swor, past participle sworen), from Proto-Germanic *swarjan-, (cf. Old Saxon swerian, Old Norse sverja, Danish sverge, Old Frisian swera, Middle Dutch swaren, Old High German swerien, German schwören, Gothic swaren "to swear"), from PIE root *swer- (1) "to speak, talk, say" (cf. Old Church Slavonic svara "quarrel"). Also related to the second element in answer. The secondary sense of "use bad language" (early 15c.) developed from the notion of "invoke sacred names." Swear-word is American English colloquial from 1883. Swear off "desist as with a vow" is from 1898.
To desist from something, with or as if with an abstemious vow: He swore off cheese and crackers for a whole week (1898+)